import dayjs from "dayjs"
import { reactive, toRefs } from "vue"

import { useCommon } from "@/stores/Common"
const CommonStore = useCommon()
const { ThirdLeafArr } = toRefs(CommonStore)

export const searchConfig = reactive({
    TimeArr: {
        component: 'ARangePicker',
        label: '时间',
        attrs: {
            allowClear: true,
            placeholder: ['开始时间', '结束时间'],
            valueFormat: 'YYYY-MM-DD',
            format: 'YYYY-MM-DD',
            presets: [
                { label: '过去3天', value: [dayjs().add(-3, 'd'), dayjs()] },
                { label: '过去7天', value: [dayjs().add(-7, 'd'), dayjs()] },
                { label: '过去30天', value: [dayjs().add(-30, 'd'), dayjs()] },
            ],
        }
    },
    departmentWardDevice: {
        component: "ACascader",
        label: "科室",
        attrs: {
            allowClear: true,
            placeholder: "科室",
            changeOnSelect: true,
            options: ThirdLeafArr,
            style: {
                width: '100%'
            }
        },
    },
    longTime: {
        component: "AInputNumber",
        label: "超时时长(分)",
        attrs: {
            allowClear: true,
            placeholder: "超时时长(分)",
            step: 1,
            defaultValue: 120,
            style: {
                width: '100%'
            }
        }
    }
})

export const searchSelfConfig = {
    TimeArr: {
        component: 'ARangePicker',
        label: '时间',
        attrs: {
            allowClear: true,
            placeholder: ['开始时间', '结束时间'],
            valueFormat: 'YYYY-MM-DD',
            format: 'YYYY-MM-DD',
            // defaultPickerValue: [dayjs().subtract(3, 'month'), dayjs().add(0, 'day')],
            style: {
                width: '100%'
            }
        },
    },
    longTime: {
        component: "AInputNumber",
        label: "超时时长(m)",
        attrs: {
            allowClear: true,
            placeholder: "超时时长(分)",
            step: 1,
            defaultValue: 120,
            style: {
                width: '100%'
            }
        }
    }
}